#ifndef FORM_MEDIUM_H
#define FORM_MEDIUM_H

#include <QWidget>
#include <QTimer>
#include <QKeyEvent>
#include "food.h"
namespace Ui {
class Form_medium;
}
enum
{
    Up,Down,Right,Left
};
class Form_medium : public QWidget
{
    Q_OBJECT
    
public:
    explicit Form_medium(QWidget *parent = 0);
    ~Form_medium();
    void setDirection(int direction);
    void keyReleaseEvent(QKeyEvent *event);
    void initGame();
    bool random_set(QString cmd="food");
    void clean_set(QString cmd="all");
    int hit();
    void getbody(int num);
    void lose(QString cmd,int num=1);
    void gain(QString cmd,int num=1);
    void addEffect(int fruitindex);
    private slots:
    void move_slot();
    void shining();
    void on_pushButton_clicked();
    void time_slot();
    void speed_up();
    void change_color();
    void slow_down();


private:
    Ui::Form_medium *ui;
    Apple* food;
    QList<Food*> snake;
    Food* head;
    QTimer* timer;
    QTimer* timer2;
    int dir;
    int speed;
    Barrier* barrier;
    QList<Barrier*> wall;
    QString skin_name;
    QString food_skin;
    QString barrier_skin;
    QList<QString> foods_name;
    QList<Food*> snakehp;
    QList<Apple*> foods;
    Food* hp;
    int score;
    bool istrue;
    int sec;
    Star* star;
    bool time_star;
    bool hurt_star;
    QList<Star*> stars;
    Fruit* fruit;
    int fruit_index;
    int x,y,limit,limit2,limit3;
};

#endif // FORM_MEDIUM_H
